<?php

namespace App\Http\Requests\Backend\Bank;

use Illuminate\Foundation\Http\FormRequest;

class ProgressBankRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $method = $this->method();
        switch ($method) {
            case 'POST':
                return [
                    'url' => 'required|string',
                    'status' => 'nullable|in:1,2',
                ];
                break;
            case 'PUT':
                return [
                    'url' => 'required|string',
                    'status' => 'nullable|in:1,2',
                ];
                break;
            default:
                return [];
        }
    }

    /**
     * Description:
     * Author: tanjun
     * DateTime: 2019-04-13 12:35
     * @return array
     */
    public function messages()
    {
        return [
            'url.required'=>'超链接必填',
            'status.in'=>'状态参数错误',
        ];
    }
}
